package Xml;

import com.thoughtworks.xstream.XStream;

public class Serealizacao {

	public static String serialize(Object obj, ClassLoader loader) {
		XStream xstream = new XStream();
		xstream.setClassLoader(loader);
		return "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
				+ xstream.toXML(obj);
	}

	public static Object deserialize(String xml, ClassLoader loader) {
		XStream xstream = new XStream();
		xstream.setClassLoader(loader);
		return xstream.fromXML(xml);
	}

}